#include<iostream>
using namespace std;
/*
C继承B B继承A C间接继承A 这就是多层继承
定义对象时:先会构建A 再构建B 最后构建C
释放对象时:先释放C 再释放B 最后释放A
*/
class A
{
    public:
    A()
    {
        cout<<"A的构造函数"<<endl;
    }
    ~A()
    {
        cout<<"A的析构函数"<<endl;
    }
    protected:
    int x;
};

class B:public A
{
    public:
    B()
    {
        cout<<"B的构造函数"<<endl;
    }
    ~B()
    {
        cout<<"B的析构函数"<<endl;
    }

};

class C:public B
{
    public:
    C()
    {
        cout<<"C的构造函数"<<endl;
    }
    ~C()
    {
        cout<<"C的析构函数"<<endl;
    }
};

int main()
{
    C c;
    return 0;
}
